{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "initial_id",
   "metadata": {
    "collapsed": true,
    "ExecuteTime": {
     "end_time": "2024-02-20T02:08:55.935153Z",
     "start_time": "2024-02-20T02:08:53.378486Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "5\n"
     ]
    }
   ],
   "source": [
    "#简易四则运算器\n",
    "num1 = input(\"输入第一个数字\")\n",
    "num2 = input(\"输入第二个数字\")\n",
    "result = eval(f\"{num1} + {num2}\")\n",
    "print(result)"
   ]
  },
  {
   "cell_type": "code",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "-20\n"
     ]
    }
   ],
   "source": [
    "num1 = input(\"输入第一个数字\")\n",
    "num2 = input(\"输入第二个数字\")\n",
    "op = input(\"请输入运算符号\")\n",
    "result = eval(f\"{num1} {op} {num2}\")\n",
    "print(result)"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-02-20T02:10:51.328526Z",
     "start_time": "2024-02-20T02:10:45.763863Z"
    }
   },
   "id": "f56d930a34c4c527",
   "execution_count": 3
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
